package com.example.userserver.enums;

public enum UserStatusEnum {
    NORMAL(1, "正常"),
    FREEZE(2, "冻结"),
    CANCEL(2, "注销"),
    ;

    private Integer code;
    private String name;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getByCode(int code){
        for (UserStatusEnum enumObject : UserStatusEnum.values()) {
            if (enumObject.code.equals(code)) {
                return enumObject.name;
            }
        }
        return null;
    }

    UserStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }
}
